<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

<xsl:template name="adv_weather_pict_viewer">
	<xsl:param name="weather_page_name"/>
	<xsl:param name="adv_pict_region"/>


	<xsl:if test="string-length(adv_pict_region)=0">
		<div align="center"><b>U.S. Map for Station Selection<br/>NOS WATER LEVEL OBSERVATION NETWORK</b></div>
		<br/><br/>
		<div align="center">
		<img SRC="{$img_path_templates}/weather/tides/regions.gif" border="0" usemap="#regions"/><br/><br/>
		<img SRC="{$img_path_templates}/weather/tides/alaska2.gif" border="0" hspace="60" usemap="#alaska2"/>
		<img SRC="{$img_path_templates}/weather/tides/hawaii.gif" border="0" hspace="60" usemap="#hawaii"/><br/><br/>
		<img SRC="{$img_path_templates}/weather/tides/world2.gif" border="0" usemap="#world"/>
		<br/>
		<form>
		 <table bordeer="0" cellspacing="0" cellpadding="0"><tr><td valign="middle">
		 <select NAME="sAdvPictRegion">
			<option value="ak">Alaska</option>
			<option value="ca">California</option>
			<option value="ct">Connecticut</option>
			<option value="de">Delaware</option>
			<option value="dc">District of Columbia</option>
			<option value="fl">Florida</option>
			<option value="ga">Georgia</option>
			<option value="hi">Hawaii</option>
			<option value="il">Illinois</option>
			<option value="la">Lousiana</option>
			<option value="me">Maine</option>
			<option value="md">Maryland</option>
			<option value="ma">Massachusettes</option>
			<option value="mi">Michigan</option>
			<option value="mn">Minnesota</option>
			<option value="ms">Mississippi</option>
			<option value="nh">New Hampshire</option>
			<option value="nj">New Jersey</option>
			<option value="ny">New York</option>
			<option value="nc">North Carolina</option>
			<option value="oh">Ohio</option>
			<option value="or">Oregon</option>
			<option value="pa">Pennsylvania</option>	
			<option value="ri">Rhode Island</option>
			<option value="sc">South Carolina</option>
			<option value="tx">Texas</option>
			<option value="va">Virginia</option>
			<option value="wi">Wisconsin</option>
			<option value="wm">Atlantic Ocean</option>
			<option value="wm">Eastern Pacific</option>
			<option value="wm">Western Pacific</option>
		 </select>
		 </td><td valign="top">&#160;&#160;
	  	 <input type="hidden" name="sWeatherMode" value="2"/>
		 <input type="Image" name="subm" align="bottom" src="{$img_path_templates}/{$header_bg_color}/buttons/btn_go.gif" value="Go"/>
		</td></tr></table>
		
		</form>
		</div>
		<map name="regions">
		<area shape="rect" alt="Maine" coords="487,27,522,61" href="{$weather_page_name}?sWeatherMode=2&amp;sAdvPictRegion=me"/>
		<area shape="rect" alt="Florida" coords="330,214,404,281" href="{$weather_page_name}?sWeatherMode=2&amp;sAdvPictRegion=fl"/>
		<area shape="rect" alt="Louisiana" coords="284,184,306,223" href="{$weather_page_name}?sWeatherMode=2&amp;sAdvPictRegion=la"/>
		<area shape="rect" alt="Mississippi" coords="307,164,330,209" href="{$weather_page_name}?sWeatherMode=2&amp;sAdvPictRegion=ms"/>
		<area shape="rect" alt="Washington" coords="13,9,78,42" href="{$weather_page_name}?sWeatherMode=2&amp;sAdvPictRegion=wa"/>
		<area shape="polygon" alt="Texas" coords="201,196,200,147,228,149,230,169,283,180,283,224,257,238,252,267,170,198" href="{$weather_page_name}?sWeatherMode=2&amp;sAdvPictRegion=tx"/>
		<area shape="rect" alt="Oregon" coords="12,43,80,85" href="{$weather_page_name}?sWeatherMode=2&amp;sAdvPictRegion=or"/>
		<area shape="polygon" alt="California" coords="11,85,14,111,45,167,79,190,101,191,104,168,52,117,52,87,13,87" href="{$weather_page_name}?sWeatherMode=2&amp;sAdvPictRegion=ca"/>
		<area shape="rect" alt="Massachussetts" coords="464,63,531,84" href="{$weather_page_name}?sWeatherMode=2&amp;sAdvPictRegion=ma"/>
		<area shape="rect" alt="New York" coords="395,52,464,86" href="{$weather_page_name}?sWeatherMode=2&amp;sAdvPictRegion=ny"/>
		<area shape="polygon" alt="Georgia" coords="356,178,361,212,390,213,394,197,373,166,354,164" href="{$weather_page_name}?sWeatherMode=2&amp;sAdvPictRegion=ga"/>
		<area shape="rect" alt="Pennsylvania" coords="403,88,445,109" href="{$weather_page_name}?sWeatherMode=2&amp;sAdvPictRegion=pa"/>
		<area shape="rect" alt="Rhode Island" coords="477,85,522,96" href="{$weather_page_name}?sWeatherMode=2&amp;sAdvPictRegion=ri"/>
		<area shape="rect" alt="Connecticut" coords="495,102,520,119" href="{$weather_page_name}?sWeatherMode=2&amp;sAdvPictRegion=ct"/>
		<area shape="rect" alt="Connecticut" coords="461,86,476,95" href="{$weather_page_name}?sWeatherMode=2&amp;sAdvPictRegion=ct"/>
		<area shape="rect" alt="New Jersey" coords="448,97,483,116" href="{$weather_page_name}?sWeatherMode=2&amp;sAdvPictRegion=nj"/>
		<area shape="rect" alt="Delaware" coords="460,118,493,135" href="{$weather_page_name}?sWeatherMode=2&amp;sAdvPictRegion=de"/>
		<area shape="rect" alt="Maryland" coords="463,137,491,154" href="{$weather_page_name}?sWeatherMode=2&amp;sAdvPictRegion=md"/>
		<area shape="rect" alt="District of Columbia" coords="438,141,462,155" href="{$weather_page_name}?sWeatherMode=2&amp;sAdvPictRegion=dc"/>
		<area shape="polygon" alt="Maryland" coords="415,110,441,111,434,121,415,110" href="{$weather_page_name}?sWeatherMode=2&amp;sAdvPictRegion=md"/>
		<area shape="polygon" alt="Virginia" coords="417,116,373,146,436,147,434,131,420,115" href="{$weather_page_name}?sWeatherMode=2&amp;sAdvPictRegion=va"/>
		<area shape="polygon" alt="North Carolina" coords="390,148,433,148,440,160,419,176,405,166,397,166,393,160,368,164,389,149" href="{$weather_page_name}?sWeatherMode=2&amp;sAdvPictRegion=nc"/>
		<area shape="polygon" alt="South Carolina" coords="376,166,396,194,415,176,402,165,374,163" href="{$weather_page_name}?sWeatherMode=2&amp;sAdvPictRegion=sc"/>
		<area shape="polygon" alt="Minnesota" coords="254,10,262,71,303,69,290,45,315,20,254,8" href="{$weather_page_name}?sWeatherMode=2&amp;sAdvPictRegion=mn"/>
		<area shape="polygon" alt="Wisconsin" coords="305,31,292,45,310,81,335,82,338,50" href="{$weather_page_name}?sWeatherMode=2&amp;sAdvPictRegion=wi"/>
		<area shape="polygon" alt="Illinois" coords="315,85,301,105,324,141,338,123,337,88,335,82,316,84" href="{$weather_page_name}?sWeatherMode=2&amp;sAdvPictRegion=il"/>
		<area shape="polygon" alt="Ohio" coords="362,91,361,118,380,124,398,107,398,88,364,90" href="{$weather_page_name}?sWeatherMode=2&amp;sAdvPictRegion=oh"/>
		<area shape="polygon" alt="Michican" coords="314,34,341,50,344,87,376,88,384,63,373,39,334,24,312,33" href="{$weather_page_name}?sWeatherMode=2&amp;sAdvPictRegion=mi"/>
		</map>
		<map name="alaska2">
		<area shape="rect" alt="Alaska Coast" coords="10,0,155,146" href="{$weather_page_name}?sWeatherMode=2&amp;sAdvPictRegion=ak"/>
		</map>
		<map name="hawaii">
		<area shape="rect" alt="Hawaii Coast" coords="2,1,92,69" href="{$weather_page_name}?sWeatherMode=2&amp;sAdvPictRegion=hi"/>
		</map>
		<map name="world">
		<area shape="polygon" alt="Atlantic Ocean" coords="163,36,114,73,104,88,159,121,139,162,146,201,165,206,200,197,215,195,214,154,196,104,188,55,171,31,156,41" href="{$weather_page_name}?sWeatherMode=2&amp;sAdvPictRegion=wm"/>
		<area shape="polygon" alt="Eastern Pacific Ocean" coords="51,36,25,58,7,87,4,114,9,145,24,168,49,189,77,204,89,209,108,198,141,198,129,127,115,98,92,99,78,67,75,41,54,32" href="{$weather_page_name}?sWeatherMode=2&amp;sAdvPictRegion=wm"/>
		<area shape="polygon" alt="Western Pacific Ocean" coords="343,36,317,43,325,64,322,81,307,93,323,126,329,134,353,174,366,175,380,151,389,121,394,49,351,29,318,43,323,62" href="{$weather_page_name}?sWeatherMode=2&amp;sAdvPictRegion=wm"/>
		</map>
	</xsl:if>
	
	<xsl:if test="string-length(adv_pict_region)>0 and string-length(adv_pict_station_info)=0">

		<div align="center">
		<table width="90%" cellpadding="0" cellspacing="0">
		<tr>
		<td align="center" valign="top"><b><xsl:value-of select="adv_pict_region_title"/></b>
		<br/><br/>
		<div align="center">
		<img SRC="{$img_path_templates}/weather/tides/{$adv_pict_region}.gif" border="0" usemap="#station"/>
		<map name="station"><xsl:value-of select="adv_pict_region_map" disable-output-escaping="yes"/></map>

		</div>
		</td></tr>
		<tr><td align="center"><form>
		 <table  cellpadding="0" cellspacing="0"><tr><td valign="middle"> 
		 <select NAME="sAdvPictStationInfo">
		    <xsl:for-each select = "adv_pict_stations/adv_pict_station">
				<option>
					<xsl:attribute name="value"><xsl:value-of select="./@adv_pict_station_value"/></xsl:attribute>
					<xsl:value-of select="."/>
				</option>
		    </xsl:for-each>
		 </select>
		 </td><td valign="top">&#160;&#160;&#160;<input type="hidden" name="sWeatherMode" value="2"/>
		<input type="hidden" name="sAdvPictRegion" value="{$adv_pict_region}"/>
		<input type="Image" name="subm" src="{$img_path_templates}/{$header_bg_color}/buttons/btn_go.gif" value="Go"/>
		</td></tr></table>
		</form></td></tr></table>
		</div>

	<br/><br/>
	</xsl:if>

	<xsl:if test="string-length(adv_pict_region)>0 and string-length(adv_pict_station_info)>0">
			<xsl:call-template name="save_adv_pict_form"/>
		<xsl:value-of select="weather_value" disable-output-escaping="yes"/>
			<xsl:call-template name="save_adv_pict_form"/>
	</xsl:if>

</xsl:template>

<xsl:template name="save_adv_pict_form" >
    <xsl:variable name="adv_pict_station_info">
		 <xsl:value-of select="adv_pict_station_info"/>
	</xsl:variable>
    <xsl:variable name="adv_pict_region">
		 <xsl:value-of select="adv_pict_region"/>
	</xsl:variable>
	  <form>
  		<!--input type="hidden" name="sSavedRegionName" value="{$save_region_name}"/-->
  		<input type="hidden" name="sWeatherMode" value="2"/>
	  	<input type="hidden" name="sAdvPictStationInfo" value="{$adv_pict_station_info}"/>
	  	<input type="hidden" name="sAdvPictRegion" value="{$adv_pict_region}"/>
	  </form>
</xsl:template>

</xsl:stylesheet>
